from dataclasses import dataclass, field


@dataclass(order=True, frozen=True)
class Person:
    sort_index: int = field(init=False, repr=False)
    name: str
    job: str
    age: int
    strength: int = 100

    def __post_init__(self):
        # self.sort_index = self.strength  # will raise error when frozen=True
        # setattr(self, 'sort_index', self.strength)  # # will raise error when frozen=True
        object.__setattr__(self, 'sort_index', self.strength)  # will work


person1 = Person('AK', 'Programmer', 25, 99)
person2 = Person('AKW', 'Programmer', 18)
person3 = Person('AKW', 'Programmer', 18)

print(id(person2))
print(id(person3))
print(person1)

print(person1 > person2)
